<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>


<style>
<!--
.notification_box  li {
	height: 30px; padding: 0px; background: #f8f8f8; float: left; width: 90px; margin-left: 10px; position: relative; border: 1px solid #ccc;
}

.notification_box .firstli {
	position: absolute; min-width: 50px; left: 3px; line-height: 31px; text-align: center;
}

.notification_box .secli {
	color: #fff; position: absolute; right: 0; width: 30px; background: #48ac2e; height: 30px; text-align: center; line-height: 31px; position: absolute;
}

html {
	overflow: auto
}
-->
</style>


<script type="text/javascript">
function incidentGridActions(rowObject) {
	if (rowObject.status != "已关闭" && rowObject.process_id) {
		return isperp.createGridAction({
			title : '转派人员',
			iconCls : 'icon-change',
			onclick :  "isperp.workflow.transferAssignee('" + rowObject.process_id + "','incidentGrid')"
		})+isperp.createGridAction({
			title : '修改内容',
			iconCls : 'icon-config',
			onclick : "isperp.openDialog({contentUrl:'incident/incident/edit?id=" + rowObject.id + "&projectId=" + rowObject.project_id + "&state=false&pcontrolid=incidentGrid&processKey=incidentProcess'})"
		})+isperp.createGridAction({
			title : '催办',
			iconCls : 'icon-notify',
			onclick : "isperp.openDialog({title:'事件催办',windowSize:'normal',contentUrl:'app/message/sender/sendEdit?title=【催办】事件编号【" + rowObject.code + "】请速处理&pcontrolid=incidentGrid&sourceId=" + rowObject.id + "'})"
		});
	}else{
		return "";
	}
}
</script>

<isperp:grid url="incident/main/serviceDeskList?team=${team }"
	actionsWidth="150" gridId="incidentGrid" sortname="create_date"
	sortorder="desc" autowidth="false"
	ondbClickRowEvent="incidentGrid.view(rowid);"
	loadComplete="isperp.loadMessageCount(data,1);"
	cusActions="incidentGridActions(rowObject);" autoReloadGrid="true"
	autoReloadTreeMenu="incidentMenu" cusViewUrl="incident/incident/view"
	advanceSearch="true" keywordFields="a.code,title,description"
	keywordTitle="输入编号/标题/描述">

	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="incidentMenu" targetGridId="incidentGrid">
		<isperp:async enable="true"
				url="incident/main/serviceDeskMenu?team=${team }"></isperp:async>
		<isperp:callback onClick="incidentMenuTree_onNodeClick"
				onAsyncSuccess="incidentMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
	<isperp:toolbar id="userToolbar">
	 
	</isperp:toolbar>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	 
	<table class="search-table">
		<tbody>
			<tr>
				<td class="td1">编号：</td>
				<td class="td2"><input type="text" field="code" op="cn">
					</td>
				<td class="td1">标题：</td>
				<td class="td2"><input type="text" field="title" op="cn">
					</td>
					<td class="td1">性质：</td>
				<td class="td2">
				   <isperp:dictSelector id="incidentType" field="incident_type" multiple="true"
							op="in" typeCode="INCIDENT_NATURE"></isperp:dictSelector>
				</td>
				
			</tr>
			<tr>
				<td class="td1">申报人：</td>
				<td class="td2"><input type="text" field="cus_user_name"
						op="cn">
					</td>
				<td class="td1">请求日期：</td>
				<td class="td2"><input id="createDateStart" type="date"
						class="date" field="create_date" op="gt" style="width: 68px" />~<input
						id="createDateEnd" class="date" type="date" field="create_date"
						op="lt" style="width: 68px" />
				</td> 
			 <td class="td1">状态：</td>
				<td class="td2"><isperp:dictSelector id="status" field="status"
							multiple="true" op="in" typeCode="INCIDENT_STATUS"></isperp:dictSelector>
				</td>
			</tr>
			
			
		</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="" hidden="true"></isperp:column>
	<isperp:column name="process_id" title="" hidden="true"></isperp:column>
	<isperp:column name="sla_status" title="" hidden="true"></isperp:column>
	<isperp:column name="priority_name" title="" width="40"
			isFormatterFun="true" formatter="return statusFormatter(rowObject);">
	</isperp:column>
	<isperp:column name="code" title="编号" width="110">
	</isperp:column>
	<isperp:column name="title" title="标题" width="120">
	</isperp:column>
	<isperp:column name="icd_category_name" title="事件分类" width="80">
	</isperp:column>
	<isperp:column name="incident_type" title="性质" width="50">
	</isperp:column>
	<isperp:column name="cus_customer_name" title="申报单位" width="70">
	</isperp:column>
	<isperp:column name="cus_user_name" title="申报人" width="60">
	</isperp:column>
	
	<isperp:column name="supporter_name" title="工程师" width="60">
	</isperp:column>
	
	<isperp:column name="create_date" title="申报时间" width="110">
	</isperp:column>
	<isperp:column name="status" title="状态" width="80">
	</isperp:column>
	</jsp:body>
</isperp:grid>

<script type="text/javascript">
	function statusFormatter(rowObject) {
		var p = 0, html = "", title = "";
		if (rowObject.priority_name != null) {

			switch (rowObject.priority_name) {
			case "一级":
				p = 1;
				break;
			case "二级":
				p = 2;
				break;
			case "三级":
				p = 3;
				break;
			case "四级":
				p = 4;
				break;
			case "五级":
				p = 5;
				break;
			}
			title = "优先级：" + p + "级";
		} else {
			title = "未确定优先级";
		}

		html = "<img title='"+title+"' src='img/incident/p"+p+".png'>";
		if (rowObject.sla_status == 1) {

			html = html + "&nbsp;<img title='SLA：异常'  src='img/incident/sla_unusual.png'>";
		}
		return html + "&nbsp;<a id='msg_" + rowObject.id + "' href=\"javascript:openRelationMessage('" + rowObject.id + "')\" class=''></a>";
	}

	function openRelationMessage(id) {

		isperp.openDialog({
			title : "查看消息",
			contentUrl : "app/message/relationMessageView?all=1&sourceId=" + id
		});
	}

	 
</script>